﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>隐藏字段</title>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../Scripts/bootstrap/js/bootstrap.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../Comm/Gener.js" type="text/javascript"></script>

    <script type="text/javascript">
        /* ESC Key Down */
        function Esc() {
            if (event.keyCode == 27)
                window.close();
            return true;
        }
        function Edit(fk_mapdata, mypk, ftype) {
            var url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrString&DoType=Edit&FK_MapData=' + fk_mapdata + '&MyPK=' + mypk + '&FType=' + ftype;
            window.location.href = url;
        }
        function EditEnum(fk_mapdata, mypk, ftype) {

            var url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrEnum&DoType=Edit&FK_MapData=' + fk_mapdata + '&MyPK=' + mypk + '&FType=' + ftype;
            window.location.href = url;
        }
        function EditTable(fk_mapdata, mypk, ftype) {
            var url = '../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrSFTable&DoType=Edit&FK_MapData=' + fk_mapdata + '&MyPK=' + mypk + '&FType=' + ftype;
            window.location.href = url;
        }

        //页面启动函数.
        $(function () {

            $("#Msg").html("<img src=../../Img/loading.gif />&nbsp;正在加载,请稍后......");

            InitPage();

            $("#Msg").html("");
        });

        //初始化数据.
        function InitPage() {

            var fk_mapData = GetQueryString("FK_MapData");

            var mapAttrs = new Entities("BP.Sys.MapAttrs");
            mapAttrs.Retrieve("FK_MapData", fk_mapData, "UIVisible", 0);

            var idx = 0;
            //增加处理.
            for (var i = 0; i < mapAttrs.length; i++) {

                var mapAttr = mapAttrs[i];

                //屏蔽掉不需要显示的.
                var keyOfEn = mapAttr.KeyOfEn;
                switch (keyOfEn) {
                    case "BatchID":
                    case "OID":
                    case "FID":
                    case "FK_NY":
                    case "RefPK":
                    case "Emps":
                    case "FK_Dept":
                    case "WFState":
                    case "RDT":
                    case "MyNum":
                    case "Rec":
                    case "CDT":
                        continue;
                    default:
                        break;
                }

                var dataType = mapAttr.MyDataType;
                var name = mapAttr.Name;
                var myPK = mapAttr.MyPK;

                var editLink = "";


                switch (mapAttr.LGType) {
                    case 0:
                        editLink = "<a href=\"javascript:Edit('" + fk_mapData + "','" + myPK + "','" + dataType + "')\"''>" + name + "</a>";
                        break;
                    case 1:
                        editLink = "<a href=\"javascript:EditEnum('" + fk_mapData + "','" + myPK + "','" + dataType + "')\"''>" + name + "</a>";
                        break;
                    default:
                        editLink = "<a href=\"javascript:EditTable('" + fk_mapData + "','" + myPK + "','" + dataType + "')\"''>" + name + "</a>";
                        break;
                }

                idx++;
                var newRow = "<tr ><td class=Idx>" + idx + "</td><td>" + keyOfEn + "</td><td>" + editLink + "</td><td>" + mapAttr.LGTypeText + "</td> <td>" + mapAttr.MyDataType + "</td> </tr>";

                $("#Table1 tr:last").after(newRow);
            }
        }
    </script>
    <base target="_self" />

</head>
<body>

    <table id="Table1" name="Table1" style="width:80%;">
        <caption>隐藏字段</caption>
        <tr>
            <th>IDX</th>
            <th>字段 </th>
            <th>名称(点击编辑) </th>
            <th>类型 </th>
            <th>数据类型 </th>
        </tr>

    </table>

    <div id="Msg"></div>

</body>
</html>
